import actionTypes from '@/types'
import type { INavBarState, IHttpResponse } from '@/interface'
const navBarState: INavBarState = {
  bindLoading: false,
  aitdMintCount: 1,
  usdtMintCount: 1,
  inviteLink: '',
  minTotalNum: 0,
  currentUserMintNum: 0,
  singleAitdPrice: 0,
  singleUsdtPrice: 0,
  usdtTotalMoney: 0, //usdt总额度
  tokenBalanceNum: 0 //授权额度  

}

interface IAction<T> {
  type: string
  payload: T
}

const navBarInitState = JSON.parse(JSON.stringify(navBarState))
function reducer(state: INavBarState, action: IAction<INavBarState>) {
  //state是一个immutable的，也就是不变的
  switch (action.type) {
    case actionTypes.navBarActionType.UPDATE_STATE:
      const payload = action.payload
      return {
        ...state,
        ...payload
      }
    default:
      return { ...state }
  }
}
export default {
  initState: navBarInitState,
  reducer,
};
